package com.example.thegreatwall.controller;

import javax.websocket.OnOpen;
import javax.websocket.Session;
import javax.websocket.server.PathParam;
import javax.websocket.server.ServerEndpoint;
import org.springframework.stereotype.Component;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

/**
 * 摇一摇
 */
@ServerEndpoint(value = "/scansocket/{socketid}")
@Component
public class ScanSocket {
    public static Map<String,Session>stringSessionMap=new HashMap<>();
    public ScanSocket() {
        System.out.println("实例化scansocket");
    }

    @OnOpen
    public void onopen(Session session, @PathParam("socketid") String socketid) throws IOException {
        System.out.print("scan，socketid:"+socketid);
        stringSessionMap.put(socketid,session);
    }
    
}
